package questionSolution.Question_1;

import java.util.Scanner;

public class Solution_1 {
    public int[] twoSum(int[] nums, int target) {
        int[] res = new int[2];
        for (int i = 0; i < nums.length; i++){
            for (int j = i+1; j< nums.length; j++){
                if (nums[i] + nums[j] == target){
                    res[0] = i;
                    res[1] = j;
                }
            }
        }
        return res;
    }

    static void main() {
        Solution_1 s = new Solution_1();
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        int[] res = new int[n];
        for(int arr_i = 0; arr_i < n; arr_i++){
            arr[arr_i] = sc.nextInt();
        }
        int target = sc.nextInt();
        res = s.twoSum(arr, target);
        System.out.println(res[0] + " " + res[1]);
    }
}
